<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8" />
		<title>position:relative定位测试</title>
		<script src="../../js/lib/jquery-v3.0.0/jquery-3.0.0.js" type="text/javascript" charset="utf-8"></script>
		<style type="text/css">
			html,
			body,
			div {
				margin: 0;
				padding: 0;
				list-style: none;
			}
			
			.center {
				margin: 30px;
				border: #999999 solid 10px;
				width: 400px;
				height: 300px;
				background: #FFFF00;
			}
			
			.div1 {
				width: 200px;
				height: 150px;
				background: #0099FF;
				position: relative;
			}
			
			.div2 {
				width: 400px;
				height: 150px;
				font-size: 30px;
				font-weight: bold;
				color: #fff;
				background: #FF0000;
			}
		</style>
	</head>

	<body>
		<div class="center">
			<div class="div1"></div>
			<div class="div2">position:relative定位测试</div>
		</div>
		<button id="change">change</button>
		<script type="text/javascript">
			$("#change").click(function() {
				$(".div1").css({
					top: '-20px',
					left: '0px'
				})
			})
		</script>
	</body>

</html>